extends Resource
class_name PlayerData

var player_id : String
var peer_id : int
var pos : Vector2 = Vector2(0.0,0.0)
var name : StringName = ""
var attack_cd_time : float = 1.2
var speed : float = 120.0
var model : String

func _get_stuct() -> Dictionary :
	return {
		"player_id" : player_id,
		"pos" : pos,
		"peer_id" : peer_id,
		"name" : name,
		"attack_cd_time" : attack_cd_time,
		"speed" : speed,
		"model" : model
	}

func _init(data : Dictionary = {}) -> void :
	player_id = data.get("player_id","")
	peer_id = data.get("peer_id",0)
	pos = data.get("pos",Vector2(0.0,0.0))
	name = data.get("name","")
	attack_cd_time = data.get("attack_cd_time",1.2)
	speed = data.get("speed",120.0)
	model = data.get("model","")
